package com.linliusheng.service;

import com.linliusheng.dao.AdministratorMapper;

import javax.swing.*;
import java.awt.*;

public class AddBook extends JPanel {

	private JLabel bookNameJLabel;
	private JLabel authorJLabel;
	private JLabel publisherJLabel;
	private JLabel priceJLabel;
	private JLabel ISBNJLabel;
	private JLabel bookTypeJLabel;

	private JTextField bookNameJText;
	private JTextField authorJText;
	private JTextField publisherJText;
	private JTextField priceJText;
	private JTextField ISBNJText;

	private JComboBox jComboBox;

	private JButton addBookButton;
	private JButton resetButton;
	private JButton returnButton;

	private Font font;

	public AddBook() {
		setSize(800,600);
		setLayout(null);
		fontSet();
		jLabelSet();
		jTextSet();
		jComboBoxSet();
		buttonSet();
	}

	public void jLabelSet() {
		bookNameJLabel = new JLabel("书名:");
		authorJLabel = new JLabel("作者:");
		publisherJLabel = new JLabel("出版社:");
		priceJLabel = new JLabel("价格:");
		ISBNJLabel = new JLabel("ISBN:");
		bookTypeJLabel = new JLabel("图书类型:");

		bookNameJLabel.setBounds(50,60, 80, 50);
		authorJLabel.setBounds(500,60,80,50);
		publisherJLabel.setBounds(50, 190, 120, 50);
		priceJLabel.setBounds(500,190, 80,50);
		ISBNJLabel.setBounds(50, 320, 120, 50);
		bookTypeJLabel.setBounds(500, 320, 140, 50);
		bookNameJLabel.setFont(font);
		authorJLabel.setFont(font);
		priceJLabel.setFont(font);
		publisherJLabel.setFont(font);
		ISBNJLabel.setFont(font);
		bookTypeJLabel.setFont(font);

		add(bookNameJLabel);
		add(authorJLabel);
		add(priceJLabel);
		add(publisherJLabel);
		add(ISBNJLabel);
		add(bookTypeJLabel);
	}

	public void jTextSet() {
		bookNameJText = new JTextField();
		authorJText = new JTextField();
		publisherJText = new JTextField();
		priceJText = new JTextField();
		ISBNJText = new JTextField();

		bookNameJText.setBounds(150, 60, 250, 50);
		authorJText.setBounds(630, 60, 250, 50);
		publisherJText.setBounds(150, 190, 250, 50);
		priceJText.setBounds(630, 190, 250, 50);
		ISBNJText.setBounds(150, 320, 250, 50);

		bookNameJText.setFont(font);
		authorJText.setFont(font);
		publisherJText.setFont(font);
		priceJText.setFont(font);
		ISBNJText.setFont(font);

		add(bookNameJText);
		add(authorJText);
		add(publisherJText);
		add(priceJText);
		add(ISBNJText);
	}

	public void jComboBoxSet() {
		jComboBox = new JComboBox();
		jComboBox.setBounds(630, 320,250,50);
		jComboBox.setFont(font);
		jComboBox.addItem(1);
		jComboBox.addItem(2);
		jComboBox.addItem(3);
		add(jComboBox);

	}

	public void buttonSet() {
		addBookButton = new JButton("添加");
		resetButton = new JButton("重置内容");
		returnButton = new JButton("返回");

		addBookButton.setBounds(240, 440, 100, 50);
		resetButton.setBounds(380, 440, 200, 50);
		returnButton.setBounds(620, 440, 100, 50);

		addBookButton.setFont(font);
		returnButton.setFont(font);
		resetButton.setFont(font);

		add(addBookButton);
		add(resetButton);
		add(returnButton);
	}
	public void fontSet() {
		font = new Font("黑体", Font.BOLD, 27);
	}
}
